package com.franklin.ideaplugin.api.beans;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.annotation.JSONType;
import com.franklin.ideaplugin.api.json.fastjson2.PresentableJsonBeanSerializer;

import java.util.LinkedHashMap;

/**
 * @author Ye Junhui
 * @since 2023/7/6
 */
public interface IPresentableJsonBean {

    /**
     * 转JSON
     * @return
     */
    default String toJsonString(){
        LinkedHashMap linkedHashMap = BeanUtil.copyProperties(this, LinkedHashMap.class);
        return JSON.toJSONString(linkedHashMap);
    }

    /**
     * 展示的字符串
     * @return
     */
    String presentableString();
}
